<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body class="layui-anim layui-anim-up">
<div class="x-nav">
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:refresh()" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <table class="layui-table">
        <thead>
        <tr>
            <th>网关服务</th>
            <th width="25%">操作</th>
        </tr>
        </thead>
        <tbody id="gateway_list">

        </tbody>
    </table>

</div>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<script type="text/javascript" src="./js/admin.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script>
    $(document).ready(function(){
        request("GET", HGW_MANAGE_API + "gateways/", "json", false,{},
            function(rsp) {
                var list_html = "";
                if(rsp.status == 1) {
                    for(var i=0; i< rsp.data.length; i++) {
                        list_html += "<tr class=\"text-c\">"
                        list_html += "<td>"+rsp.data[i].server_name+"</td>"
                        list_html += "<td class=\"f-14 td-manage\"> " +
                                "<a onClick=\"gateway_info(this,'"+rsp.data[i].server_name+"')\" title=\"详情\">详情" +
                                "</td>"
                        list_html += "</tr>"
                    }
                }
                $("#gateway_list").html(list_html);
                $('.layui-table').dataTable({
                    "bStateSave": true,//状态保存
                    "pading":false,
                    "searching": false,
                    "lengthChange" : false,
                });
            });
    });

    function gateway_info(obj, server_name) {
        x_admin_show('网关详情',"gateway-info.html?server_name="+decodeURI(server_name));
    }

    function refresh() {
        location.replace(location.href);
    }
</script>
</body>

</html>